package com.bx.imserver.config;

import com.bx.imserver.netty.WebSocketAuthHandler;
import com.bx.imserver.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @PROJECT_NAME: ws-server
 * @DESCRIPTION:
 * @USER: 15202845751
 * @DATE: 2024/5/29 10:43
 */
@Configuration
public class WebSocketConfig {
    // 令牌秘钥
    @Value("${token.secret}")
    private String secret;

    @Autowired
    private RedisCache redisCache;

    @Bean
    public WebSocketAuthHandler webSocketAuthHandler() {
        WebSocketAuthHandler rs= new WebSocketAuthHandler();
        rs.setSecret(secret);
        rs.setRedisCache(redisCache);
        return rs;
    }
}